home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Utilities
/
Printer
/
aa_Intel_Only
/
lprManager.0.01
/
lprManager
/
AppController.m
< prev
next >
Wrap
Text File
|
1995-09-17
|
2KB
|
77 lines
//////////////////////////////////////////////////////////////////////////
//
// lprManager.app
//
// FileName : AppController.m
//
// Written by zander@cnext.crec.mipt.ru (Aleksey Sudakov)
// Sept. 13,1995
// Last Modified Sept. 13,1995
//
#import "AppController.h"
#import <misckit/MiscShell.h>
@implementation AppController
+ initialize
{
static NXDefaultsVector IRCDefaults =
{
{"Server", "samsung"},
{NULL, NULL}
};
NXRegisterDefaults("lprManager", IRCDefaults);
return self;
}
- appDidInit:(Application *)sender
{
[[NXApp appListener] setServicesDelegate:self];
return self;
}
/*
- info:sender // bring up the info panel, obviously
{
return [infoControl infoPanel];
}
*/
- showPrefs:sender
{
if(!prefController)
[NXApp loadNibSection:"Preferences.nib" owner:self];
[[prefController window] makeKeyAndOrderFront:sender];
return self;
}
- printOnLpr:pasteboard userData:(const char*)userData error:(char**)msg
{
const NXAtom* types;
char* text;
id shell;
int length;
for(types = [pasteboard types]; *types; types++)
if( *types == NXAsciiPboardType ) break;
if( *types == 0 )
{
*msg = "Could not print selection";
return nil;
}
if( [pasteboard readType:NXAsciiPboardType
data:&text length:&length] == nil )
{
*msg = "Could not read selection";
return nil;
}
shell = [[MiscShell alloc] initWithCommand:
[[[[[[MiscString newWithString:"echo \""]
concatenate:[MiscString newWithString:text]]
concatenate:[MiscString newWithString:"\" | lpr -P"]]
concatenate:[MiscString newWithString:
NXGetDefaultValue("lprManager","Server")]]
concatenate:[MiscString newWithString:"\n"]]
stringValue]];
vm_deallocate(task_self(), (vm_address_t)text, length);
return self;
}
@end